package com.lizemin.arthas.controller;

import com.lizemin.arthas.entiry.Teacher;
import com.lizemin.arthas.entiry.User;
import com.lizemin.arthas.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lzm
 * @date 2025/5/24 9:46
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    @GetMapping("/heartbeat")
    public String heartbeat() {
        return "ok";
    }

    @GetMapping("/getTeacher")
    public Teacher getTeacher(int id) {
        log.info("请求参数：id = {}", id);
        Teacher teacher = new Teacher();
        teacher.setId(id);
        teacher.setName("csdn - " + id);
        return teacher;
    }

    @GetMapping("/getUsers")
    public List<User> getUsers(int start, int end) {
        log.info("请求参数：start = {}, end = {}", start, end);
        return testService.getUsers(start, end);
    }


}
